home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / c-tools / c_examples / msgprompt / msgprompt.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-22  |  1.3 KB  |  56 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. // msgprompt.cpp
  3. //
  4. // Jeffry A Worth
  5. // November 10, 1995
  6. //////////////////////////////////////////////////////////////////////////////
  7.  
  8. //////////////////////////////////////////////////////////////////////////////
  9. // INCLUDES
  10. #include <string.h>
  11. #include "aframe:include/msgprompt.hpp"
  12. #include "aframe:include/button.hpp"
  13. #include "aframe:include/rastport.hpp"
  14.  
  15. //////////////////////////////////////////////////////////////////////////////
  16. //
  17.  
  18. AFMsgPrompt::AFMsgPrompt()
  19. {
  20.   m_pgadgets = NULL;
  21. }
  22.  
  23. ULONG AFMsgPrompt::Prompt(AFWindow* pParent, char* szMessage, char* szTitle, ULONG uFlags)
  24. {
  25.   AFRastPort rp(pParent);
  26.   AFRect rect;
  27.   AFNode *node;
  28.   AFButton *button;
  29.   long length;
  30.  
  31.   length = rp.TextLength(szMessage, strlen(szMessage));
  32.   rect.SetRect(10,10,10+length+25,110);
  33.   Create(pParent->m_papp,&rect,szTitle);
  34.  
  35.   rp.FromWindow(this);
  36.   rp.SetAPen(1);
  37.   rp.TextOut(10,10,szMessage,strlen(szMessage));
  38.  
  39.   button = new AFButton;
  40.   rect.SetRect(10,50,70,65);
  41.   button->Create("OK",this,&rect,100);
  42.   RefreshGadgets();
  43.   
  44.   WaitPort(m_pWindow->UserPort);
  45.  
  46.   DestroyWindow();
  47.   delete button;
  48.  
  49.   return 100;
  50. }
  51.  
  52. ULONG AFMsgPrompt::WindowFlags()
  53. {
  54.   return WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET | WFLG_ACTIVATE | WFLG_GIMMEZEROZERO;
  55. }
  56.